const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const homeRouter = require('./routes/home')
const newsRouter = require('./routes/news')
const uploadRouter = require('./routes/upload')
const app = express();


app.use(bodyParser.urlencoded({extended: false}));
app.use(bodyParser.json());
app.use('/static', express.static(path.join(__dirname,'public')))
// 告诉express 视图文件的目录
app.set('views', path.join(__dirname, 'views'));
// 设置express模板引擎为ejs
app.set('view engine', 'ejs');


app.use(homeRouter);
app.use(newsRouter);
app.use(uploadRouter);

app.listen(9527, ()=>{ 
	console.log('start at port 9527');
})